from django.urls import path
from rest_framework.routers import DefaultRouter
from .views import *

urlpatterns = [
    path('payment/<pk>/',PaymentViewSet.as_view({'get':'retrieve'})), # 支付路由
    path('payment/',PaymentViewSet.as_view({'put':'update'})), # 支付路由
    # path('student/<pk>/',StudentViewSet.as_view({'get':'retrieve','put':'update','delete':'destroy'}))

]
router = DefaultRouter()  # 实例化路由器
router.register('classification', ClassificationViewSet)
router.register('classifications', ClassificationStudentViewSet)
router.register('commodity', CommodityViewSet)
router.register('commoditys', CommodityStudentViewSet)
router.register('cart', ShoppingCartViewSet, basename='shopping_cart')
router.register('order', OrderViewSet, basename='order')
urlpatterns += router.urls  # 获取生成的路由列表
